//  Copyright (c) 2018-present, Cruise LLC
//
//  This source code is licensed under the Apache License, Version 2.0,
//  found in the LICENSE file in the root directory of this source tree.
//  You may not use this file except in compliance with the License.

@import "./reset.scss";
@import "./colors.module.scss";
@import "./mixins.module.scss";
@import "./fonts.module.scss";
@import "~rc-color-picker/assets/index.css";

.rc-color-picker-panel {
  // TOOLBAR
  background: $dark2;
  .rc-color-picker-panel-inner {
    box-shadow: none;
    // DARK7
    border: 1px solid #4b4b52;
  }
  .rc-color-picker-panel-ribbon,
  .rc-color-picker-panel-alpha {
    span {
      // LIGHT1
      border: 1px solid #f0f0f0;
    }
  }
}

/* globally apply flex to containers outside our component hierarchy */
/* this ensures the app container elements stretch edge to edge and do not scroll */
html,
body,
#root,
.app-container {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 100%;
  background: $background;
  overflow: hidden;

  font-size: $text-size;
  color: $text-normal;
  @include sans-serif;
}

// Make sure everything uses box-sizing: border-box.
// Per https://www.paulirish.com/2012/box-sizing-border-box-ftw/
// When changing this, be aware that Mosaic also adds this by default.
html {
  box-sizing: border-box;
}
*,
*:before,
*:after {
  box-sizing: inherit;
}

#root > span,
#root > span > span {
  // Wrappers added by storycap.
  display: block;
  height: 100%;
}

#root {
  // ensure portals are able to stack on top of the main app
  z-index: 0;
}

::selection {
  background-color: transparentize($text-normal, 0.4);
}

code,
pre,
tt {
  @include monospace;
  overflow-wrap: break-word;
}

code {
  background-color: lighten($background, 20%);
  border-radius: 0.2em;
  padding: 0 0.25em;
}

button,
input,
select,
textarea,
.text-area-style {
  @include sans-serif;
  color: $text-control;
  font-size: 1rem;
  text-align: left;
  background-color: $background-control;
  border-radius: 4px;
  border: none;
  padding: 8px 12px;
  margin: $control-margin;

  &:focus {
    outline: none;
  }
}

input,
select,
textarea,
.text-area-style {
  color: $text-control;
  background-color: rgba(255, 255, 255, 0.05);

  &:focus {
    background-color: rgba(255, 255, 255, 0.075);
  }

  &.disabled {
    color: $text-input-disabled;
    background-color: rgba(255, 255, 255, 0.3);
  }
}

textarea,
.text-area-style {
  @include monospace;
  border: 2px solid $text-normal;
  color: $text-normal;
}

div::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

div::-webkit-scrollbar-track {
  background: transparent;
}

div::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

a {
  color: $text-control;
  &:hover {
    color: $text-control-hover;
  }
}

i,
em {
  font-style: italic;
}

b,
strong {
  @extend %bold;
}

p {
  margin: 1em 0;
  &:last-child {
    margin-bottom: 0;
  }
}

hr {
  border: none;
  display: block;
  height: 1px;
  margin: 0;
  padding: 0;
  background-color: $divider;
}

button {
  text-align: center;

  &.is-danger {
    background-color: $red;
  }
  &.is-warning {
    background-color: $background-control;
  }

  &:not(.disabled):not(:disabled):hover {
    cursor: pointer;
    color: $text-control-hover;
  }

  &.is-primary {
    background-color: $green;
    color: $background;
  }
  &.selected {
    background-color: $dark5;
    color: $text-normal;
  }
  &.disabled,
  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
  &.is-small {
    padding: 4px 8px;
  }
}

th {
  color: $text-normal;

  tr:first-child & {
    padding-top: 4px;
    padding-bottom: 4px;
  }
}

th,
td {
  border: 1px solid $divider;
  padding: 0 0.3em;
  line-height: 1.3em;
}

tr {
  svg {
    opacity: 0.6;
  }
}

tr:hover {
  td {
    background-color: $dark4;
    cursor: pointer;
  }

  svg {
    opacity: 0.8;
  }
}
